/*
*ALG treeSum avoid int overflow
*2018-10-8
*Marc He
*/

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    freopen("dataIn","r",stdin);
    int N; cin>>N;
    int *Arr = new int[N];
    for(int i=0;i<N;i++)cin>>Arr[i];
    int cnt = 0 ;
    long long t_sum = 0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            t_sum = Arr[i]+Arr[j];
            if(t_sum>INT_MAX) continue;
            for(int k=0;k<N;k++){
                if(t_sum+Arr[k] == 0)cnt++;
            }
        }
    }
    cout<<cnt<<endl;
    delete [] Arr;
    return 0;
}
